import {GET_MAPBOX_MAP} from "./CreateMap";

let animatePointGeoJson = {
    type: 'FeatureCollection',
    features: [
        {
            type: 'Feature',
            properties: {},
            geometry: {
                type: 'Point',
                coordinates: [],
            },
        },
    ],
};

// 无人机坐标更新
const MAP_ANIMATE_ING = (values, layerKey = '无人机飞行') => {
    const map = GET_MAPBOX_MAP();

    animatePointGeoJson.features[0].geometry.coordinates = [values.droneLongitude, values.droneLatitude];
    animatePointGeoJson.features[0].properties = {
        ...values,
        layerKey,
        bearing: values.yaw, //方向
    };

    map.getSource('animatePointLayer').setData(animatePointGeoJson);

    map.moveLayer('animatePointLayer', 'arrowLayer', 'routeLayer');
};
